<?php

namespace App\Http\Controllers;

use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
    
    public function returnOk($data=[],$msg=null)
    {
        $return['code'] = 200;
        $return['data'] = $data;
        $return['msg'] = $msg??'成功';
        return response()->json($return);
    }

    public function returnError($data=[],$code,$msg)
    {
        $return['code'] = $code;
        $return['data'] = $data;
        $return['msg'] = $msg;
        return response()->json($return);
        // return response()->json(['name' => 'Abigail', 'state' => 'CA']);
    }
}
